package ru.digitanoise.dnaccountapi.controllers;

import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import ru.digitanoise.dnaccountapi.services.AccountService;

@RestController
@RequestMapping("/active/account")
@RequiredArgsConstructor
public class ActiveAccountController {

    private final AccountService accountService;

    @PostMapping
    public ResponseEntity<Void> activeAccount(
            @RequestParam String code
    ) {
        accountService.accountActive(code);

        return ResponseEntity.ok().build();
    }
}
